package com.example.abc.dto.account;

import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.StringUtils;

/**
 * Created by Peter on 2018/5/3.
 */
public class AuthorityTreeDto {
    private String id;
    private String parent;
    private String text;
    private AuthorityTreeStateDto state =new AuthorityTreeStateDto();
    private String type = "file";
    private Aattr a_attr = new Aattr();

    public Aattr getA_attr() {
        return a_attr;
    }

    public void setA_attr(Aattr a_attr) {
        this.a_attr = a_attr;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public AuthorityTreeStateDto getState() {
        if(StringUtils.isNotBlank(a_attr.getA_class())){
            state.setChecked(true);
            state.setSelected(true);
        }
        return state;
    }

    public void setState(AuthorityTreeStateDto state) {
        this.state = state;
    }

    public String getId() {
        if(id.equals("0")){
            id = "#";
        }
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getParent() {
        if(parent.equals("0")){
            parent = "#";
        }
        return parent;
    }

    public void setParent(String parent) {
        this.parent = parent;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }
}
